// 线样式枚举
const lineTypeEnum = [
  { key: '__________', value: 'solid' },
  { key: '----------', value: 'dashed' },
  { key: '................', value: 'dotted' },
];
// 线条粗细
function lineType(params) {
  const { name, value } = params || {};
  return {
    name: name || '样式',
    code: 'type',
    value: value || 'solid',
    type: 'Select',
    enumValue: lineTypeEnum,
  };
}

export default {
  name: '轨迹层',
  code: 'custom_map_group_track',
  version: '1.0.0',
  config: [
    {
      name: '轨迹样式',
      code: 'line',
      children: [
        {
          name: '线条颜色',
          code: 'lineColor',
          value: '#f12250',
          type: 'ColorSelector',
        },
        {
          name: '线条宽度(1~99)',
          code: 'lineWidth',
          value: 2,
          min: 1,
          max: 99,
          type: 'InputNumber',
          unit: 'px',
        },
        lineType(),
        {
          name: '轨迹显示位置',
          code: 'position',
          type: 'Radio',
          value: 'default',
          enumValue: [
            { key: '默认', value: 'default' },
            { key: '自适应居中', value: 'center' },
            { key: '当前位置', value: 'current' },
          ],
        },
      ],
    },
    {
      name: '重置按钮设置',
      code: 'button',
      children: [
        {
          name: '文本设置',
          code: 'font',
          type: 'FontGroup',
          value: {
            fontSize: 18,
            fontFamily: 'siyuan',
            color: '#FFF',
            fontWeight: 'bold',
          },
        },
        {
          name: '背景颜色',
          code: 'backgroundColor',
          value: '#666',
          type: 'ColorSelector',
        },
        {
          name: '边框设置',
          code: 'border',
          children: [
            {
              name: '边框线条粗细',
              code: 'borderWidth',
              value: 2,
              type: 'InputNumber',
              max: 99,
              min: 1,
            },
            {
              name: '边框线条色',
              code: 'borderColor',
              value: '#4A4A4A',
              type: 'ColorSelector',
            },
            {
              name: '圆角设置',
              code: 'borderRadius',
              value: '10',
              type: 'InputNumber',
              max: 99,
              min: 1,
            },
          ],
        },
        {
          name: '按钮位置',
          code: 'position',
          children: [
            {
              name: '横坐标',
              code: 'left',
              value: '20',
              type: 'InputNumber',
              min: 0,
              unit: 'px',
            },
            {
              name: '纵坐标',
              code: 'top',
              value: '20',
              type: 'InputNumber',
              min: 0,
              unit: 'px',
            },
          ],
        },
      ],
    },
  ],
  data: {
    field: [{ name: 'points', mapper: 'points' }],
    type: 1,
    value: JSON.stringify([
      {
        points: '122.68,45.51;122.43,37.77;123.43,34.77;125.43,36.77',
      },
      {
        points: '124.68,43.51;126.43,33.77',
      },
    ]),
  },
  events: {},
};
